<?php

class invoice_ref extends CActiveRecord
{
	/**
	 * The followings are the available columns in table 'invoice_ref':
	 * @var integer $id
	 * @var integer $inv_id
	 * @var string $ref_type
	 * @var string $ref
	 */

	/**
	 * Returns the static model of the specified AR class.
	 * @return CActiveRecord the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'invoice_ref';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		return array(
                        array('inv_no, po_no, other_no, do_no','safe'),
			array('ref_type','length','max'=>5),
			array('ref','length','max'=>30),
			array('inv_id, ref_type, ref', 'required'),
			array('inv_id', 'numerical', 'integerOnly'=>true),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'Id',
			'inv_id' => 'Inv',
			'ref_type' => 'Ref Type',
			'ref' => 'Ref',
		);
	}
}